<?php
class Admin_Form_Feature extends Zend_Form {

	public function __construct($options = null) {
		parent::__construct ( $options );
		
		$categoryPath = new Zend_Form_Element_Hidden('categoryPathOld');
		$categoryPath->setValue($options['categoryPath'])
		->setAttrib('class', 'form-control')
		->setDecorators ( array (
				'ViewHelper'
		) );
		
		$titleVi = new Zend_Form_Element_Text ( 'titleVi' );
		$titleVi->addFilter ( 'StringTrim' )
			->setRequired ( true )
			->addValidator ( 'NotEmpty' )
			->setAttrib('class', 'form-control')
            ->setAttrib ( 'placeholder', 'Nhập tên danh mục thuộc tính...' )
            ->setDecorators ( array (
				'ViewHelper' 
		) );
		
		$weight = new Zend_Form_Element_Text ( 'weight' );
		$weight->addFilter ( 'StringTrim' )
			->addFilter ( 'Int' )
			->addValidator ( 'NotEmpty' )
			->setAttrib ( 'class', 'form-control' )
			->setAttrib ( 'style', 'width:230px' )
			->setValue ( '999' )
			->setDecorators ( array (
				'ViewHelper' 
		) );
		
		$status = new Zend_Form_Element_Radio ( 'status' );
		$status->addFilter('StringTrim')	
		->setAttrib ( 'class', 'grey' )
		->setMultiOptions(array('1' => " Có", '0' => ' Không'))
		->setValue('1')		
		->setDecorators ( array (
				'ViewHelper'
		) );
			
		$isMultiImage = new Zend_Form_Element_Radio( 'isMultiImage' );
		$isMultiImage->addFilter('StringTrim')
		->setAttrib ( 'class', 'grey' )
		->setMultiOptions(array('1' => " Có", '0' => ' Không'))
		->setValue('0')
		->setDecorators ( array (
				'ViewHelper'
		) );
		
		$isDetailProduct = new Zend_Form_Element_Radio( 'isDetailProduct' );		
		$isDetailProduct->addFilter('StringTrim')	
		->setAttrib ( 'class', 'grey' )
		->setMultiOptions(array('1' => " Có", '0' => ' Không'))
		->setValue('0')		
		->setDecorators ( array (
				'ViewHelper'
		) );
		
		$arrElement = array (
				$categoryPath,
				$titleVi,
				$weight,
				$status,
				$isMultiImage,
				$isDetailProduct
		);
		
		if (ENGLISH == 1) {
			$titleEn = new Zend_Form_Element_Text ( 'titleEn' );
			$titleEn->addFilter ( 'StringTrim' )
				->setRequired ( true )
				->addValidator ( 'NotEmpty' )
				->setAttrib('class', 'form-control')
            	->setAttrib ( 'placeholder', 'Nhập tên danh mục thuộc tính (Tiếng anh)...' )            
				->setDecorators ( array (
					'ViewHelper' 
			) );
			
			$arrElement [] = $titleEn;
		}
		
		$this->addElements ( $arrElement );
	}
}
